<?php

use yii\db\Migration;

/**
 * Handles the creation of table `image`.
 */
class m190118_060209_create_image_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('image', [
            'id' => $this->primaryKey()->comment("id"),
            'image'=>$this->string()->comment("图片地址"),
            'is_cdn'=>$this->tinyInteger()->defaultValue(0)->comment("已储存到cdn"),
            'created_at'=>$this->integer()->comment("创建时间"),
            'type'=>$this->tinyInteger()->comment("类型")->defaultValue(1),
            'status'=>$this->tinyInteger()->comment("状态")->defaultValue(10),
            'alt'=>$this->string()->comment("描述")->defaultValue("图片"),
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('image');
    }
}
